{include file="common/head"/}
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try{ace.settings.check('main-container' , 'fixed')}catch(e){}
    </script>
    {include file="common/left"}
    <div class="main-content">
        <div class="main-content-inner">
            {include file="common/header_nav"}
            <div class="page-content">
                <div class="row maintop">
                    <div class="col-xs-12 col-sm-2">
                        <a href="{:url('memberAdd')}">
                            <button class="btn btn-xs btn-danger">
                                <i class="ace-icon fa fa-plus bigger-110"></i>
                                添加会员
                            </button>
                        </a>
                    </div>
                    <form name="admin_list_sea" class="form-search" method="post" action="{:url('memberList')}">
                        <div class="col-xs-12 col-sm-6 btn-sespan">
                            <div class="input-group">
                                <span class="input-group-addon">
                                    <i class="ace-icon fa fa-search"></i>
                                </span>
                                <input type="text" name="val" id="val" class="form-control search-query admin_sea" value="{$testkey}" placeholder="输入用户名或者邮箱"/>
                                <span class="input-group-btn">
                                    <button type="submit" class="btn btn-xs btm-input btn-purple">
                                        搜索
                                    </button>
                                </span>
                            </div>
                        </div>
                        <div class="input-group-btn">
                            <a href="{:url('memberList')}">
                                <button type="button" class="btn btn-xs all-btn btn-purple">
                                    <span class="ace-icon fa fa-refresh icon-on-right bigger-110"></span>
                                    显示全部
                                </button>
                            </a>
                        </div>
                    </form>
                </div>
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <div class="row">
                            <div class="col-xs-12">

                                <div class="table-responsive">
                                    <table id="simple-table" class="table table-striped table-bordered table-hover center">
                                        <thead>
                                        <tr>
                                            <!--<th class="center visible-lg visible-md">登陆次数</th>-->
                                            <th class="center">ID</th>
                                            <th class="center">用户名</th>
                                            <th class="center visible-lg visible-md">昵称/邮箱</th>
                                            <th class="center">性别</th>
                                            <th class="center hidden-xs">会员用户组</th>
                                            <th class="center visible-lg visible-md">添加时间</th>
                                            <th class="center">状态</th>
                                            <th class="center" style="border-right:#CCC solid 1px;">操作</th>
                                        </tr>
                                        </thead>

                                        <tbody>
                                        {volist name="memberList" id="v"}
                                        <tr>
                                            <td>{$v.member_id}</td>
                                            <td>{$v.username}</td>
                                            <td class="visible-lg visible-md">{$v.petname}【{$v.email}】</td>
                                            <td>{if condition="$v.sex eq 1"}男{else/}女{/if}</td>
                                            <td class="hidden-xs">{$v.name}</td>
                                            <td class="visible-lg visible-md">{$v.create_time|date='Y-m-d h:i:s',###}</td>
                                            <td>
                                                {if condition='$v["open"] eq 1'}
                                                <a class="red" href="javascript:;" onclick="return stateyes({$v.member_id});" title="已开启">
                                                    <div id="zt{$v.member_id}">
                                                        <button class="btn btn-minier btn-yellow">
                                                            状态开启
                                                        </button>
                                                    </div>
                                                </a>
                                                {else/}
                                                <a class="red" href="javascript:;" onclick="return stateyes({$v.member_id});" title="已禁用">
                                                    <div id="zt{$v.member_id}">
                                                        <button class="btn btn-minier btn-danger">
                                                            状态禁用
                                                        </button>
                                                    </div>
                                                </a>
                                                {/if}
                                            </td>
                                            <td>
                                                <div class="action-buttons">
                                                    <a class="green" href="{:url('memberEdit',['member_id'=>$v['member_id']])}" title="修改">
                                                        <i class="ace-icon fa fa-pencil bigger-130"></i> </a>
                                                    <a class="red" href="javascript:;" onclick="return del({$v.member_id});" title="删除">
                                                        <i class="ace-icon fa fa-trash-o bigger-130"></i> </a>
                                                </div>
                                            </td>
                                        </tr>
                                        {/volist}
                                        <tr>
                                            <td colspan="8" align="left">&nbsp;</td>
                                        </tr>
                                        </tbody>
                                    </table>
                                </div>

                            </div><!-- /.span -->
                        </div><!-- /.row -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    {include file="common/foot" /}

</div><!-- /.main-container -->

<!-- inline scripts related to this page -->
<script type="text/javascript">
    function del(id) {
        layer.confirm('你确定要删除吗？', {icon: 3}, function (index) {
            layer.close(index);
            window.location.href = "{:url('memberDel')}?member_id=" + id;
        });
    }
    function stateyes(id) {
        $.post('{:url("memberState")}', {id: id}, function (data) {
            if (data.status) {
                if (data.info == '状态禁止') {
                    var a = '<button class="btn btn-minier btn-danger">状态禁用</button>'
                    $('#zt' + id).html(a);
                    layer.msg(data.info, {icon: 5});
                    return false;
                } else {
                    var b = '<button class="btn btn-minier btn-yellow">状态开启</button>'
                    $('#zt' + id).html(b);
                    layer.msg(data.info, {icon: 6});
                    return false;
                }
            }
        });
        return false;
    }
</script>
</body>
</html>
